define([ "PDUtilDir/grid", "PDUtilDir/searchBlock" ], function(Grid,
		SearchBlock, Slidebar, Tool) {
	function init(types, addObj, updateObj, delObj, searchObj) {
		SearchBlock.init('searchBlockId');
		// 初始化
		return Grid({
			id : "LineGirdDivId",
			pageSize : 10,
			index : true,
			multi : true,
			pagination : true,
			cache : false,
			layout : [ {
				name : "名称",
				field : "name",
				sort : true,
				click : function(e) {
					updateObj.run(e.data.row);
				}
			}, {
				name : "类型",
				field : "type",
				width : "10%",
				format : function(e) {
					if (!types)
						return;
					for (var i = 0; i < types.length; i++) {
						if (types[i].dictCode == e.row.type) {
							return types[i].dictName;
						}
					}
				}
			}, {
				name : "创建人",
				field : "createUserName",
				width : "10%"
			}, {
				name : "创建时间",
				field : "createTime",
				width : "10%"
			} ],
			toolbar : [ {
				name : "添加",
				icon : "fa fa-plus-circle",
				callback : function(event) {
					addObj.run();
				}
			}, {
				name : "删除",
				icon : "fa fa-trash-o",
				callback : function(event) {
					delObj.run();
				}
			}, {
				name : "查询",
				icon : "fa fa-search",
				callback : function(event) {
					searchObj.run();
				}
			} ],
			data : {
				type : 'URL',
				value : getServer() + '/flea/hclv/line/queryAllForPage.htmls'
			}
		});
	}
	return {
		init : init
	}
});